$(document).ready( function() {
	//$('input[placeholder], textarea[placeholder]').placeholder();
	$("input[type='text']:first").focus().select();
	//$('#userid').focus();
	$(".btn_login").on("click",function() {
		login();
	});

});

function login(){
	var _actionUrl = "/servlet/com.ubst.smartad.login.LoginServlet";

	var _userid = $('#login_id').val();
	var _passwd = getPassword();
	if(_userid=="" || _userid=="{ID_TEXT}"){
		alert("{REQUIRED_ID_TEXT}");
		$('#userid').focus();
		return;
	}

	if(_passwd=="" || _passwd=="{PW_TEXT}"){
		alert("{REQUIRED_PW_TEXT}");
		$('#passwd').focus();
		return;
	}
	var _param = "userid="+_userid
		+"&passwd="+_passwd
		+"&";
	var form = document.login;
	form.action = _actionUrl;
	form.target = "_self";
	form.submit();
	//openUrl(document.paraForm, _actionUrl, "_self", _param);
}

// (cross script)
function getPassword(){
	var _pw = $('input[type=password]').val();
	if(typeof _pw == 'undefined'){
		_pw = $('input[realType=password]').val();
	}
	if(typeof _pw == 'undefined'){
		_pw = $('input[placeholder]:last').val();
	}

/*
	    if ($.browser.msie) {
			_pw = $('input[realType=password]').val();
		}else{
			_pw = $('input[type=password]').val();
		}
*/
	return _pw;
}
